package work.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 学生实体
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Student implements Comparable<Student> {
    private String name;

    private String age;

    /**
     * 序号值
     */
    private Integer index;

    public Student(String name, String age) {
        this.name = name;
        this.age = age;
    }

    public Student(String name, Integer index) {
        this.name = name;
        this.index = index;
    }

    @Override
    public int compareTo(Student o) {
        return Integer.parseInt(this.age) - Integer.parseInt(o.age);
    }
}
